﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace AnesSystem.Controls.CommonTables.SC.CDTY
{
    /// <summary>
    /// ShuHouZhengTongCtrl.xaml 的交互逻辑
    /// </summary>
    public partial class ShuHouFangShiCtrl : CustomCommonTableCtrl
    {
        public ShuHouFangShiCtrl()
        {
            InitializeComponent();
            rq.GotFocus += rq_GotFocus;
            bbsj.GotFocus += rq_GotFocus;
            qxsj.GotFocus += qxsj_GotFocus;
            bgsj.GotFocus += qxsj_GotFocus; 

             DateTime ssrqj = DataManager.Instance.CurrentPatientLink.Status.OperStartTime;
            if (!ssrqj.Equals(new DateTime()))
            {
                ssrq.Text = Convert.ToDateTime(ssrqj).ToString(DateFormat.DATE_FORMAT_STR_YMD);
            }
            DateTime mzjssjj = DataManager.Instance.CurrentPatientLink.Status.MazuiEndTime;
            if (!mzjssjj.Equals(new DateTime()))
            {
                mzjssj.Text = Convert.ToDateTime(mzjssjj).ToString("HH:mm");
            }
        }

        private void rq_GotFocus(object sender, RoutedEventArgs e)
        {
            CustomTextCtrl cutext = sender as CustomTextCtrl;
            CusDatePickerWin cusDatePicker = new CusDatePickerWin();
            cusDatePicker.SelectedDateTime = DateTime.Now;
            cusDatePicker.ShowDialog();
            if (cusDatePicker.Result)
            {
                cutext.Value = cusDatePicker.SelectedDateTime.ToString(DateFormat.DATE_FORMAT_STR_YMD_CN);//xxxx年xx月xx日
            }

        }

        private void qxsj_GotFocus(object sender, RoutedEventArgs e)
        {
            CustomTextCtrl cutext = sender as CustomTextCtrl;
            CusDatePickerWin cusDatePicker = new CusDatePickerWin();
            cusDatePicker.SelectedDateTime = DateTime.Now;
            cusDatePicker.ShowDialog();
            if (cusDatePicker.Result)
            {
                cutext.Value = cusDatePicker.SelectedDateTime.ToString(DateFormat.DATE_FORMAT_STR_HM);//xxxx年xx月xx日
            }

        }

       
        
    }
}
